#include <bits/stdc++.h>

#define in read()
#define fi first
#define se second
#define pb push_back
#define y1 y_alpha_1

using namespace std;

using ll = long long;
using db = double;
using vec = vector<int>;
using pii = pair<int,int>;

int read() {
	int x = 0; bool f = 0; char ch = getchar();
	while(!isdigit(ch)) f |= ch == '-',ch = getchar();
	while(isdigit(ch)) x = (x << 1) + (x << 3) + (ch ^ 48),ch = getchar();
	return f ? -x : x;
}

const int N = 1e5+10;

int fro[N],b[N],a[N],tot,n,cnt[N];
ll ans[N];

int main() {
#ifndef ONLINE_JUDGE
	freopen("1.in","r",stdin);
#endif
	n = in; for(int i = 1;i <= n;i++) a[i] = b[i] = in,ans[1] += a[i]; sort(b + 1,b + n + 1); tot = unique(b + 1,b + n + 1) - b - 1;
	for(int i = n;i >= 1;i--) a[i] = lower_bound(b + 1,b + tot + 1,a[i]) - b,fro[a[i]] = i,cnt[a[i]]++;
	for(int i = tot;i > a[1];i--) {
		int del = b[i] - b[i - 1]; cnt[i] += cnt[i + 1]; if(i < tot) fro[i] = min(fro[i + 1],fro[i]);
		ans[fro[i]] += (ll) del * cnt[i]; ans[1] -= (ll) del * cnt[i];
	}
	for(int i = 1;i <= n;i++) printf("%lld\n",ans[i]);
	return 0;
}
